/*     */ package com.lmpop.trade.ti_invoice;
/*     */ 
/*     */ import com.lmpop.frame.QueryList;
/*     */ import com.lmpop.frame.SysMap;
/*     */ import com.lmpop.frame.TradeInterf;
/*     */ import com.lmpop.frame.dao.DbmInterf;
/*     */ import com.lmpop.frame.exp.ApplicationException;
/*     */ import com.lmpop.trade.tb_commpara.Tb_commparaInfo;
/*     */ import java.util.Hashtable;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class Ti_invoiceInfo
/*     */   implements TradeInterf
/*     */ {
/*     */   QueryList queryList;
/*     */ 
/*     */   public Ti_invoiceInfo()
/*     */   {
/*  16 */     this.queryList = new QueryList();
/*     */   }
/*     */ 
/*     */   public SysMap insert(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  25 */     String result_code = "0";
/*  26 */     Tb_commparaInfo commpara = new Tb_commparaInfo();
/*     */     try {
/*  28 */       String if_need_invoice = map.getString("if_need_invoice");
/*  29 */       if (if_need_invoice.equals("0"))
/*     */       {
/*  31 */         String invoice_order_no = map.getString("invoice_order_no");
/*  32 */         if (!invoice_order_no.equals(""))
/*     */         {
/*  34 */           String[] in_orders = invoice_order_no.split("\\|");
/*  35 */           for (int i = 0; i < in_orders.length; i++) {
/*  36 */             Hashtable onMap = new Hashtable();
/*  37 */             onMap.put("order_no", in_orders[i]);
/*  38 */             onMap.put("invoice_no", map.getString("invoice_no"));
/*  39 */             onMap.put("invoice_top", map.getString("invoice_top"));
/*  40 */             onMap.put("invoice_content", map.getString("invoice_content"));
/*  41 */             onMap.put("company", map.getString("invoice_company"));
/*  42 */             onMap.put("tax_no", map.getString("invoice_tax_no"));
/*  43 */             onMap.put("address", map.getString("invoice_address"));
/*  44 */             onMap.put("phone", map.getString("invoice_phone"));
/*  45 */             onMap.put("bank", map.getString("invoice_bank"));
/*  46 */             onMap.put("account", map.getString("invoice_account"));
/*  47 */             insertFromOrder(dbmMgr, onMap);
/*     */           }
/*     */         }
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/*  53 */       e.printStackTrace();
/*  54 */       result_code = "1";
/*     */     }
/*  56 */     map.setString("result_code", result_code);
/*  57 */     return map;
/*     */   }
/*     */ 
/*     */   public void insert(DbmInterf dbmMgr, Ti_invoice ti_invoice)
/*     */     throws ApplicationException
/*     */   {
/*  66 */     dbmMgr.update("insertTi_invoice", ti_invoice);
/*     */   }
/*     */ 
/*     */   public SysMap insertFromOrder(DbmInterf dbmMgr, SysMap map)
/*     */   {
/*  76 */     String result_code = "0";
/*  77 */     Tb_commparaInfo commpara = new Tb_commparaInfo();
/*     */     try {
/*  79 */       String if_need_invoice = map.getString("if_need_invoice");
/*  80 */       if (if_need_invoice.equals("0"))
/*     */       {
/*  82 */         String trade_no = map.getString("trade_no");
/*  83 */         String invoice_no = "";
/*  84 */         String invoicetype = "";
/*  85 */         Hashtable onMap = new Hashtable();
/*  86 */         onMap.put("order_no", trade_no);
/*     */ 
/*  88 */         if ((!map.getString("invoicetype").equals("")) && (map.getString("invoicetype") != null)) {
/*  89 */           invoicetype = map.getString("invoicetype");
/*  90 */           invoice_no = commpara.getOneComparaPcode2ByP3("21", invoicetype);
/*     */         } else {
/*  92 */           invoice_no = map.getString("invoice_no");
/*     */         }
/*  94 */         onMap.put("invoice_no", invoice_no);
/*  95 */         onMap.put("invoice_top", map.getString("invoice_top"));
/*  96 */         onMap.put("invoice_content", map.getString("invoice_content"));
/*  97 */         onMap.put("company", map.getString("invoice_company"));
/*  98 */         onMap.put("tax_no", map.getString("invoice_tax_no"));
/*  99 */         onMap.put("address", map.getString("invoice_address"));
/* 100 */         onMap.put("phone", map.getString("invoice_phone"));
/* 101 */         onMap.put("bank", map.getString("invoice_bank"));
/* 102 */         onMap.put("account", map.getString("invoice_account"));
/* 103 */         insertFromOrder(dbmMgr, onMap);
/*     */       }
/*     */     }
/*     */     catch (ApplicationException e) {
/* 107 */       e.printStackTrace();
/* 108 */       result_code = "1";
/*     */     }
/* 110 */     map.setString("result_code", result_code);
/* 111 */     return map;
/*     */   }
/*     */ 
/*     */   public void insertFromOrder(DbmInterf dbmMgr, Hashtable map)
/*     */     throws ApplicationException
/*     */   {
/* 120 */     dbmMgr.update("insertTi_invoice", map);
/*     */   }
/*     */ 
/*     */   public SysMap delete(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 133 */     String order_no = map.getString("order_no");
/* 134 */     String result_code = "0";
/*     */     try {
/* 136 */       if (!order_no.equals("")) delete(dbmMgr, order_no); 
/*     */     }
/*     */     catch (ApplicationException e) {
/* 138 */       e.printStackTrace();
/* 139 */       result_code = "1";
/*     */     }
/* 141 */     map.setString("result_code", result_code);
/* 142 */     return map;
/*     */   }
/*     */ 
/*     */   public void delete(DbmInterf dbmMgr, String pkid)
/*     */     throws ApplicationException
/*     */   {
/* 151 */     dbmMgr.update("deleteTi_invoice", pkid);
/*     */   }
/*     */ 
/*     */   public SysMap update(DbmInterf dbmMgr, SysMap map)
/*     */   {
/* 160 */     Ti_invoice ti_invoice = new Ti_invoice();
/* 161 */     ti_invoice.setOrder_no(map.getString("invoice_order_no"));
/* 162 */     ti_invoice.setCompany(map.getString("invoice_company"));
/* 163 */     ti_invoice.setTax_no(map.getString("invoice_tax_no"));
/* 164 */     ti_invoice.setAddress(map.getString("invoice_address"));
/* 165 */     ti_invoice.setPhone(map.getString("invoice_phone"));
/* 166 */     ti_invoice.setBank(map.getString("invoice_bank"));
/* 167 */     ti_invoice.setAccount(map.getString("invoice_account"));
/*     */ 
/* 169 */     String result_code = "0";
/*     */     try {
/* 171 */       update(dbmMgr, ti_invoice);
/*     */     } catch (ApplicationException e) {
/* 173 */       e.printStackTrace();
/* 174 */       result_code = "1";
/*     */     }
/* 176 */     map.setString("result_code", result_code);
/* 177 */     return map;
/*     */   }
/*     */ 
/*     */   public void update(DbmInterf dbmMgr, Ti_invoice ti_invoice)
/*     */     throws ApplicationException
/*     */   {
/* 186 */     dbmMgr.update("updateTi_invoice", ti_invoice);
/*     */   }
/*     */ 
/*     */   public List getListByPage(Object obj, int start, int limit)
/*     */   {
/* 196 */     Ti_invoice ti_invoice = (Ti_invoice)obj;
/* 197 */     Map params = new Hashtable();
/* 198 */     if (start == 0)
/* 199 */       start = 0;
/*     */     else {
/* 201 */       start = (start - 1) * limit;
/*     */     }
/* 203 */     ti_invoice.setStart(Integer.valueOf(start));
/* 204 */     ti_invoice.setLimit(Integer.valueOf(limit));
/*     */ 
/* 206 */     return this.queryList.getList("getListByTi_invoicePage", ti_invoice);
/*     */   }
/*     */ 
/*     */   public int getCountByObj(Object obj)
/*     */   {
/* 218 */     Ti_invoice ti_invoice = (Ti_invoice)obj;
/* 219 */     List list = this.queryList.getList("getCountByObjTi_invoice", ti_invoice);
/* 220 */     int count = 0;
/* 221 */     if ((list != null) && (list.size() > 0)) {
/* 222 */       Hashtable newsMap = (Hashtable)list.get(0);
/* 223 */       if ((newsMap.get("count") != null) && (!newsMap.get("count").toString().equals(""))) {
/* 224 */         count = Integer.parseInt(newsMap.get("count").toString());
/*     */       }
/*     */     }
/* 227 */     return count;
/*     */   }
/*     */ 
/*     */   public List getListByPk(String pk)
/*     */   {
/* 237 */     return this.queryList.getList("getTi_invoiceByPk", pk);
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.trade.ti_invoice.Ti_invoiceInfo
 * JD-Core Version:    0.6.0
 */